home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 080 (1988-11-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 080 (1988-11-15)(Ossowski, Stefan)(DE)(PD).adf / OOPS! / Oops!.c < prev    next >
C/C++ Source or Header  |  1988-08-14  |  3KB  |  90 lines

  1. /******************************************************************************
  2. **********                                 **********
  3. **********    Oops! - Changes WB's background color to ???         **********
  4. **********                                 **********
  5. *******************************************************************************
  6. **********                                 **********
  7. **********          Designed by Magic Ceee 07-AUG-87             **********
  8. **********                                 **********
  9. **********    This stuff is in the public domain - enjoy!          **********
  10. **********                                 **********
  11. ******************************************************************************/
  12.  
  13. #include "exec/types.h"
  14. #include "exec/memory.h"
  15. #include "graphics/gfxbase.h"
  16. #include "graphics/copper.h"
  17. #include "hardware/custom.h"
  18. #include "intuition/intuition.h"
  19.  
  20. #define NO_INTUI    "Intuition won't open!\n"
  21. #define NO_GFX        "Graphix won't open!\n"
  22.  
  23. struct IntuitionBase    *IntuitionBase;
  24. struct GfxBase        *GfxBase;
  25. struct ViewPort        *MagicView;
  26. struct UCopList     *MagicList;
  27. struct UBYTE        *AllocMem();
  28. extern struct Custom     custom;
  29.  
  30.  
  31. /******************************************************************************
  32. *** y[]   = Vertical beam position                         ***
  33. *** col[] = Colortable. Starts at $000 (Black), ends at $FFF (Blue)        ***
  34. ******************************************************************************/
  35.  
  36. static int pos[] = { 0,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,
  37.              114,120,126,132,138,144,150,156,162,168,174,180,188,194 };
  38.  
  39. static int col[] = { 0x000,0x001,0x002,0x003,0x004,0x005,0x006,0x007,0x008,
  40.                0x009,0x00a,0x00b,0x00c,0x00d,0x00e,0x00f,0x00f,0x00e,
  41.                0x00d,0x00c,0x00b,0x00a,0x009,0x008,0x007,0x006,0x005,
  42.                0x004,0x003,0x002,0x001,0x000 };
  43.  
  44.  
  45. /******************************************************************************
  46. ***            Let the colorful times roll...                ***
  47. ******************************************************************************/
  48.  
  49. main()
  50. {
  51.  int i;
  52.  
  53.  if(!(IntuitionBase=(struct IntuitionBase *)
  54.    OpenLibrary("intuition.library",0)))
  55.      {
  56.       Write(Output(),NO_INTUI,strlen(NO_INTUI));
  57.       exit(0); 
  58.      }
  59.  
  60.  if(!(GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0)))
  61.    {
  62.     Write(Output(),NO_GFX,strlen(NO_GFX));
  63.     CloseLibrary(IntuitionBase);
  64.     exit(0);
  65.    }
  66.  
  67.  MagicView=GfxBase->ActiView->ViewPort;        /* Current ViewPort */
  68.  
  69.  MagicList=AllocMem(sizeof(struct UCopList),MEMF_PUBLIC|MEMF_CLEAR);
  70.  
  71.  
  72.  /* for(i=0;i<31;i++) pos[i]+=30;  <-- PAL offset (256 video lines) */
  73.  
  74.  
  75.  for(i=0;i<31;i++)
  76.     {
  77.      CWAIT(MagicList,pos[i],0);            /* Wait til pos[i] */
  78.      CMOVE(MagicList,custom.color[0],col[i]);     /* Use new color */
  79.     }
  80.  
  81.  CEND(MagicList);    /* New UCopList installed */
  82.  
  83.  MagicView->UCopIns=MagicList;    /* Tell Copper bout new list */
  84.  RethinkDisplay();        /* At this point, it's going to be funny
  85.                    as hell... */
  86.  
  87.  CloseLibrary(IntuitionBase);
  88.  CloseLibrary(GfxBase);        /* Ceee you! */
  89. }
  90.